package com.hiss.basic.admin.controller;

import com.hiss.basic.starter.core.model.R;
import com.hiss.basic.starter.websocket.model.MessageModel;
import com.hiss.basic.starter.websocket.publisher.WebSocketMessagePublisher;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/websocket")
public class WebSocketController {

    @RequestMapping(value = "/publish", method = RequestMethod.POST)
    public R<Void> publish(@RequestBody MessageModel messageModel) {
        WebSocketMessagePublisher.publish(messageModel);
        return R.success();
    }
}
